Skip to content

Migrate to Vue 3 - #1025

Open
mchoo7 wants to merge 48 commits into
swiftlang:mainfrom
mchoo7:vue3
Open

mchoo7 wants to merge 48 commits into
swiftlang:mainfrom
mchoo7:vue3

Conversation

@mchoo7

@mchoo7 mchoo7 commented Jul 29, 2026 •

Copy link
Copy Markdown

Bug/issue #976 #977, if applicable:

Summary

As mentioned in #976, this project is currently using Vue 2. Not only this leaves bugs from dependencies (unless we patch against individual deps), using EOL-ed software leaves security holes that can be exploited in many ways, especially in these days where LLM can find dozens of security flaws in a few hours. After this change, pnpm outdated will show nothing (there is deprecated package warning from js-beautify, but it's not our responsibility).

Screenshot:

Screenshot 2026-07-28 at 20 06 30

Notes

  • For dependency-specific notes, see Dependencies section
  • The best way to test this on your machine is 1) clone my fork and 2) run pnpm instsall && pnpm run docs
  • Every JS scripts are now in ESM. package.json now sees .js files as ESM files not CJS. ("type": "module")
  • The best way to review this work is reviewing commit-by-commit.
  • 3a0c7d5 has patch for tree-sitter because of C++ build issue and they had problem with publishing 0.25.1 which had the fix. 0.25.1 was published after i made the commit, so the patch was reverted and tree-sitter was upgraded to 0.25.1.
  • The copyright banner in .editorconfig is removed because 1) it's functionally identical to vue template and 2) I don't think it's creative enough to be copyrighted (I'm not a lawyer though).
  • This patch was driven by GPT 5.6 Sol through Codex. I tried this migration three times by myself more than a year ago and failed. In February I tried again twice with Claude Opus 4.6, but failed. GPT did this work without much problem but this PR still needs to be reviewed cautiously.

Breaking Changes

For Users

There is no breaking changes for users at least according to the spec. The only pitfall here is the browerlist. Vite 8 has stricter browser compatibility then our current browserlist, but I'm pretty sure for generated code the old code is more compatible for (very) legacy browsers. For example, support for Internet Explorer is now fully dropped.

For Developers

  • Node 24 (or 22, see Dependencies section) is required.
  • serve is renamed to dev to follow vite convention
  • Default port for dev (previously serve) is now 5173 (vite's default)
  • VUE_APP_* is now VITE_* (this is what vite expects)

Future plans

I will do the following:

  • Switch npm to pnpm
  • Remove some of the turned-off eslint rules
  • Introduce prettier (from Vue 3 template)
  • Introduce typescript (from Vue 3 template)

This PR is groundwork for the following optional improvements, but I won't or currently have no plan to do:

  • Use Pinia (default store for Vue 3) for stores. However I don't know if Pinia is a good solution for this project.
  • Introduce vapor mode for Vue 3.6 (requires rewrite in composition api, might not worth)
  • SSG (probably through Nuxt), requires major architecture overhaul

Dependencies

  • Node 24 (latest lts) is now default. package.json will allow Node 22, but if your node version manager(s) read .nvmrc, they will complain about it because .nvmrc cannot store multiple major versions.
  • jest is replaced by vitest
  • babel is removed as it's not necessary anymore
  • postcss and autoprefixer are removed (vite ships lightningcss by default)
  • oxlint is added. eslint covers what oxlint can't yet (this is from Vue 3 template)
  • Vue-related deps are upgraded for Vue 3
  • intersection-observer is dropped
  • Some eslint plugins are removed and added, mostly due to eslint 10 compatibility
  • tree-sitter is upgraded to 0.25. tree-sitter-vue was dropped because it was Vue 2-only and @vue/compiler-sfc is added to replace its functionality.
  • See diff for package.json for minor changes.

Testing

Invoking test is same as before, except that vitest is now the backend (it's easier to sync with vite and vue). However, changes to test files need to be reviewed for sure.

This needs to be tested with other documentations such as the Swift documentation or the Apple documentation. However, I don't know how to test against these and don't have time for that, so I hope Swift/Apple devs can do this for me.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran npm test, and it succeeded
  • Updated documentation if necessary

Fixes: #976
Fixes: #977

@heckj

heckj commented Jul 29, 2026

Copy link
Copy Markdown
Member

Lots of lifting in this - I'm likely the last to provide useful feedback, but I went ahead and asked an LLM to look over the PR for any low-hanging fruit feedback that might help improve this if the DocC render maintainers are so inclined.

From that output:

  • OverviewCard's "head" slot looks like it was dropped.
  • BreakpointEmitter.spec.js looks like the test was gutted, not actually updated.
  • The LLM asserted that Accessibility linting was added, then more or less shut down/neutered. My personal take is leaning more heavily into active linting to guide feedback on the migration, so from my point view, I'd re-enable all the base linting it disabled, and consider adding more were relevant, and let the agents churn on resolving and fixing.
  • vitest expect-expect and valid-expect are apparently also disabled.

I stumbled over pnpm test not passing as well, but didn't dig into that detail at any level.

(note: I am not a maintainer on this project, more a very interested consumer of it)

@mchoo7

mchoo7 commented Jul 30, 2026

Copy link
Copy Markdown
Author

OverviewCard's "head" slot looks like it was dropped.

I don't see any change made to OverviewCard.
https://github.com/mchoo7/swift-docc-render/blob/vue3/src/components/ContentNode/OverviewCard.vue

BreakpointEmitter.spec.js looks like the test was gutted, not actually updated.

Updated

The LLM asserted that Accessibility linting was added, then more or less shut down/neutered. My personal take is leaning more heavily into active linting to guide feedback on the migration, so from my point view, I'd re-enable all the base linting it disabled, and consider adding more were relevant, and let the agents churn on resolving and fixing.
vitest expect-expect and valid-expect are apparently also disabled.

I was going to do ESLint (and Prettier) in a follow-up PR.

I stumbled over pnpm test not passing as well, but didn't dig into that detail at any level.

I don't see any failures. Could you share the error message please?

@mportiz08 mportiz08 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mchoo7. Apologies for not getting to this sooner, but I really appreciate the effort that went into making such a large PR--especially since this migration task is something I was hoping to look into myself soon.

It will take some time to thoroughly review and test these changes, but I wanted to let you know that I've started to look through this and try it out. Thanks!

Comment thread package.json Outdated
@mchoo7

mchoo7 commented Oct 14, 2026

Copy link
Copy Markdown
Author

During unit test, 65% of time was spent on jsdom creation. We now use vmThreads pooling which reduces unit test time by 83% (30.1s to 5.1s).

@mportiz08

Copy link
Copy Markdown
Member

I've been doing some manual testing with example documentation content before getting to thoroughly review the changed files, and things are generally looking pretty good so far.

I'm still testing, but here are a few minor issues I've noticed that we'll want to fix:

  • the footer is much too big on pages with little content and looks broken (404 page is easy example of this)
  • the color of the main "Documentation" link in the sidebar is now blue but should remain white (easy to miss since it is usually not linked in most archives)
  • the URLs for linkable headings seem off--looks like maybe the forward slashes in the URL are getting percent encoded or something

@mportiz08 mportiz08 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still testing and reviewing the changes.

Here are a couple of new issues I've noticed:

  • the linked "Documentation" sidebar link is still blue instead of white (doesn't seem like your previous fix worked here)
  • same issue with the "[Name] Tutorials" link in the tutorials navbar where [Name] is now blue when it shouldn't be
  • the primary/secondary dropdowns in the tutorials navbar seem to be missing visual borders, and they don't work unless you click the exact text
  • for the TutorialsOverview page, the spacing looks off for the left-hand-side chapter menu

@mchoo7

mchoo7 commented Oct 21, 2026

Copy link
Copy Markdown
Author

Still testing and reviewing the changes.

Here are a couple of new issues I've noticed:

  • the linked "Documentation" sidebar link is still blue instead of white (doesn't seem like your previous fix worked here)
  • same issue with the "[Name] Tutorials" link in the tutorials navbar where [Name] is now blue when it shouldn't be
  • the primary/secondary dropdowns in the tutorials navbar seem to be missing visual borders, and they don't work unless you click the exact text
  • for the TutorialsOverview page, the spacing looks off for the left-hand-side chapter menu

I asked LLM to fix the issues for now.

However, the docs provided by this repository does not have Documentation link or any tutorial page, so I cannot verify by myself. Is there a way to obtain a good docc for testing (e.g. xcode)?

@mportiz08

Copy link
Copy Markdown
Member

I asked LLM to fix the issues for now.

Great, I think these issues are resolved now. Thanks!

However, the docs provided by this repository does not have Documentation link or any tutorial page, so I cannot verify by myself. Is there a way to obtain a good docc for testing (e.g. xcode)?

One way is to download the "SlothCreator" sample code from here and build the archive with Xcode and/or DocC itself. You can then point DocC-Render at the built archive or directly build it with the version of DocC-Render here.

Probably the easiest way is to create an empty tutorial using docc init. Something like:

# create Example.docc with stub tutorial page
xcrun docc init --name Example --output-dir . --template tutorial

Here is some additional documentation on directly integrating a built version of this renderer with DocC itself using the DOCC_HTML_DIR var. (I haven't tested this on the branch yet but will soon)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support a modern Node Version Vue is very outdated and unsafe

3 participants